<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>路线管理</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/member/route/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label
                                    class="search-form-lable">路线名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="routeName" autocomplete="off" class="layui-input"
                                           value="${input.routeName}" placeholder="请输入路线名称">
                                </div>
                            </li>
<%--                            <c:if test="${!isChild || isXzgsAdmin}">
                                <li class="form-item-inline"><label class="search-form-lable">所属机构</label>
                                    <div class="layui-input-inline">
                                        <select name="memberGroupId">
                                            <option value="">全部</option>
                                            <c:forEach var="memberGroup" items="${memberGroupList}">
                                                <option value="${memberGroup.id}" ${memberGroupId == memberGroup.id ? 'selected="selected"' : ''}>${memberGroup.realname}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </li>
                            </c:if>--%>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">创建时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty input.timeType || input.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${input.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${input.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${input.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${input.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${input.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${input.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content">
                <div class="cl">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="210">
                            <col width="160">
                            <col width="160">
                            <col width="160">
                            <col width="100">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>路线名称</th>
                            <th>路线起点</th>
                            <th>路线终点</th>
                            <th>创建时间</th>
                            <th>操作</th>
                            <th>数据状态</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="cRoute" items="${cRoutes}">
                            <tr class="detail-content1">
                                <td>
                                    <div>${cRoute.routeName}</div>
                                </td>
                                <td>
                                    <div>${cRoute.sPlace}</div>
                                </td>
                                <td>
                                    <div>${cRoute.cPlace}</div>
                                </td>
                                <td>
                                    <div><fmt:formatDate value="${cRoute.createDate}"
                                                         pattern="yyyy-MM-dd HH:mm"/></div>
                                </td>
                                <td class="opts-btns tb-opts" style="width: 330px">
                                    <div class="comm-opts">
                                        <a class="green"
                                           href="${ctx}/member/route/memberRouteList.do?routeId=${cRoute.id}">
                                            路线分析
                                        </a>
                                        <a class="green"
                                           href="${ctx}/member/route/form.do?id=${cRoute.id}">编辑</a>
                                        <a class="red"
                                           href="javascript:txz.deleteObject('确定要删除吗？','${ctx}/member/route/delete.do?id=${cRoute.id}')">删除</a>
                                        <a class="red"
                                           href="javascript:initializationData('确定要重新生成数据吗？','${ctx}/member/route/initData.do?id=${cRoute.id}')">重新生成数据</a>
                                    </div>
                                </td>
                                <td>
                                    <c:if test="${cRoute.dataTotal == cRoute.routeInfoTotal}">
                                        <div class="green">
                                            生成完成
                                        </div>
                                    </c:if>
                                    <c:if test="${cRoute.dataTotal != cRoute.routeInfoTotal}">
                                        <div class="red">
                                            数据生成中
                                        </div>
                                    </c:if>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <c:if test="${page.totalCount == 0}">
                        <div class="f16 tc mt15">还没有数据</div>
                    </c:if>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            var start = {
                elem: 'input[name=createStart]'
            };
            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        })
    })

    initializationData = function (content, url, tip, myForm) {
        top.layer.confirm(content, {
            icon: 3,
            title: '系统提示'
        }, function (index) {
            top.layer.close(index);
            //loading层
            var loadIndex = layer.load(1, {
                shade: [0.1, '#fff'] //0.1透明度的白色背景
            });
            $.post(url, {}, function (data) {
                top.layer.close(loadIndex);
                if (data.success) {
                    util.layerMsgSuccess("数据初始化中", function () {
                        if (util.isValid(myForm)) {
                            submitFunction(myForm);
                        } else {
                            window.location.reload();
                        }
                    })
                } else {
                    util.layerMsgError(tip || data.description || '初始化失败');
                }
            });
        });
    }

</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '路线管理',
            curr: true
        }]
        ,
        btns: [{
            name: '添加路线',
            icon: 'add',
            href: '${ctx}/member/route/form.do',
            isCheckExpire: true
        }]
    });
</script>
</body>
</html>